package com.zxp.zxpsmarthomeapk.util;

import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class AnimUtils {
    public static void playViewAnim(Context context, View view, int animResId) {
        playViewAnim(context, view, animResId, 0, 0);
    }

    public static void playViewAnim(Context context, View view, int animResId, int duration, int delay) {
        Animation anim = AnimationUtils.loadAnimation(context, animResId);
        if (view != null && anim != null) {
            if (delay > 0) {
                anim.setStartOffset(delay);
            }
            if (duration > 0) {
                anim.setDuration(duration);
            }
            view.startAnimation(anim);
        }
    }
}
